<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>投诉列表</title>
    <style>
        body {
            font-family: 'Segoe UI', sans-serif;
            max-width: 1200px;
            margin: 20px auto;
            padding: 0 20px;
        }

        h1 {
            text-align: center;
            color: #2c3e50;
            margin-bottom: 15px;
            font-size: 2.2em;
        }

        table {
            border-collapse: collapse;
            width: 100%;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            border-radius: 8px;
            overflow: hidden;
        }

        th,
        td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }

        th {
            background-color: #34495e;
            color: white;
            font-weight: 600;
        }

        tr:nth-child(even) {
            background-color: #f8f9fa;
        }

        tr:hover {
            background-color: #f1f4f7;
        }

        .filter-container {
            text-align: center;
            margin-bottom: 50px;
        }

        select,
        button {
            padding: 8px 12px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 1em;
            margin: 0 5px;
        }

        button {
            background-color: #3498db;
            color: white;
            cursor: pointer;
        }

        button:hover {
            background-color: #2980b9;
        }
    </style>
</head>
<body>
<h1>投诉列表</h1>
<div class="filter-container">
    <form th:action="@{/selectAllByName}" method="post">
            <select name="brandName">
                <option value="">全部</option>
                <option th:each="brand : ${brands}" th:value="${brand.brandName}"
                        th:text="${brand.brandName}"></option>
            </select>
        <button type="submit">查询</button>
    </form>
    <button><a th:href="@{/addTable}" style="color: white">添加投诉</a></button>
    <button><a th:href="@{/login}" style="color: white">退出登录</a></button>

</div>
<table>
    <thead>
    <tr>
        <th>投诉编号</th>
        <th>投诉品牌</th>
        <th>投诉问题</th>
        <th>投诉车系</th>
        <th>投诉时间</th>
        <th>投诉状态</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="complaint : ${complaints}">
        <td th:text="${complaint.id}"></td>
        <td th:text="${complaint.brandName}"></td>
        <td th:text="${complaint.problem}"></td>
        <td th:text="${complaint.carType}"></td>
        <td th:text="${#dates.format(complaint.complaintsTime, 'yyyy-MM-dd')}"></td>
        <td th:text="${complaint.status == 0 ? '信息审核' : (complaint.status == 1 ? '厂家受理' : '')}"></td>
        <td>
            <a th:href="@{/selectAllByName(brandName=${complaint.brandName})}">编辑</a>
        </td>
    </tr>
    </tbody>
</table>

</body>
</html>
